#input thread_id,and view its posts
import __main__
from appengine_utilities import sessions
from appengine_utilities import flash
from appengine_utilities import event
from appengine_utilities import cache
from appengine_utilities.rotmodel import ROTModel
import wsgiref.handlers

from google.appengine.ext import webapp
from google.appengine.ext.webapp import template
from BeautifulSoup import BeautifulSoup
import xmw
from xmw import tianya

from xmw import error
import os
import urllib2, urllib
import uuid

from google.appengine.ext import webapp

class MainPage(xmw.RequestHandler):
    def get(self):
        self.sess = sessions.Session()
        self.cookie_sess = sessions.Session(writer="cookie")
        """
        if self.sess.has_key("user"):
            self.sess.delete()  
        """
        if self.sess.has_key("user"):
            self.sess["user"].delete()
        self.clear_sess()
        
        #self.redirect("/")
        #return 
        #template_values ={"is_anonymous":True}
        self.render_template(None, "../html/logout.html")
        return

def main():
    application = webapp.WSGIApplication(
                                       [('/logout', MainPage)],
                                       debug=True)
    wsgiref.handlers.CGIHandler().run(application)

if __name__ == "__main__":
  main()
